package com.kaifamiao.annotation;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Controller;

import java.util.logging.Logger;

// <bean id="tigerController" class="com.kaifamiao.annotation.TigerController" />
// @Controller("tigerController")
@Controller
public class TigerController {

    private static Logger logger = Logger.getGlobal();

    @Autowired
    @Qualifier("tigerService")
    private TigerService tigerService;

    public void add( String name ) {
        logger.info( "添加老虎" );
        Tiger t = new Tiger();
        t.setName( name );
        tigerService.save(t);
    }

    public TigerService getTigerService() {
        return tigerService;
    }

    public void setTigerService(TigerService tigerService) {
        this.tigerService = tigerService;
    }
}
